<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <input type="text" v-model="data.vls">
    <button @click="add()">添加</button>
    <ul>
      <li v-for="(value,index) in data.list">
        {{value}} <button @click="del(index)">删除</button>
      </li>
    </ul>
    <button @click="clr()">清除</button>
  </div>


  <script type="module">
    import { createApp, reactive } from '../vue.esm-browser.js'
    createApp({
      setup() {
        const data = reactive({
          vls: 'www.baidu.com',
          list: ['cxk', '你干嘛！']
        })
        const add = () => {
          data.list.push(data.vls)
        }
        const del = (index) => {
          data.list.splice(index, 1)
        }
        const clr = () => {
          data.list = []
        }
        return {
          data,
          add,
          del,
          clr
        }
      }
    }).mount('#app')
  </script>
</body>

</html>